package com.gong.book.dao;

import com.gong.book.model.BookInfo;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;
import org.springframework.stereotype.Repository;

import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.List;


@Repository
public class BookDao {


    public List<BookInfo> mockData(){
        //应该从数据库中获得
        List<BookInfo> bookInfos = new ArrayList<BookInfo>();
        for (int i = 0; i < 15; i++) {
            BookInfo bookInfo = new BookInfo();
            bookInfo.setId(i);
            bookInfo.setBookName("图书" + i);
            bookInfo.setAuthor("作者"+i);
            bookInfo.setCount(i);
            bookInfo.setPrice(new BigDecimal(i));
            bookInfo.setPublish("出版社名称" + i);
            if(i%5 == 0){
                bookInfo.setStatus(2);
                //bookInfo.setStateCN("不可借阅");
            }else{
                bookInfo.setStatus(1);
                //bookInfo.setStateCN("可以借阅");
            }
            bookInfos.add(bookInfo);
        }
        return bookInfos;
    }

}
